open F,"plant-training.txt";

while(!eof(F)) {

  $header = <F>;
  $header =~ /#(\d)/;
  $class = $1;
  $count[$class]++;
  
  $img = "";
  for $row_i (1..6) {
    $row_data = <F>;
    chomp($row_data);
    $img = $img.$row_data;
  }
  
  @imgN = split/\s+/,$img;
  shift @imgN;
  for $i (0..35) {
    if ($class == 1) {
      $tot[$class][$i] += $imgN[$i];
    } else {
      $tot[$class][$i] += $imgN[$i];
    }
  }
}

for $c (0..1) {
  print "#$c: $count[$c]";
  for $i (0..35) {
    print " ";
    if ($i % 6 == 0) {
      print "\n";
    }
    #print $tot[$c][$i]."\t";
    printf "%.3f\t",$tot[$c][$i]/$count[$c];
  }
  print "\n";
}

print "#1 - #0";
for $i (0..35) {
  print " ";
  if ($i % 6 == 0) {
    print "\n";
  }
  printf "%.3f\t",$tot[1][$i]/$count[1]-$tot[0][$i]/$count[0];
}
print "\n";


